from .base import Handler
from event_engine.event import Event
from event_engine.engine import EventEngine
from models.house import House


class SaveHouseHandler(Handler):
    """
    保存房产信息
    """

    def process(self, event: Event, engine: EventEngine) -> None:
        data: dict = event.data
        House(
            type=data["type"],
            community_code=data["community_code"],
            house_code=data["house_code"],
            name=data["name"],
            city=data["city"],
            district=data["district"],
            circle=data["circle"],
            price=data["price"],
            area=data["area"],
            bedroom=data["bedroom"],
            sitting_room=data["sitting_room"]
        ).save()
